// OutGauge - EXTERNAL DASHBOARD SUPPORT
// ========
// The user's car in multiplayer or the viewed car in single player or
// single player replay can output information to a dashboard system
// while viewed from an internal view.
// This can be controlled by 5 lines in the cfg.txt file :
// OutGauge Mode 0 :0-off 1-driving 2-driving+replay
// OutGauge Delay 1 :minimum delay between packets (100ths of a sec)
// OutGauge IP 0.0.0.0 :IP address to send the UDP packet
// OutGauge Port 0 :IP port
// OutGauge ID 0 :if not zero, adds an identifier to the packet
// Each update sends the following UDP packet :
struct OutGaugePack
{
unsigned Time; // time in milliseconds (to check order)
char Car[4]; // Car name
word Flags; // Info (see OG_x below)
byte Gear; // Reverse:0, Neutral:1, First:2...
byte SpareB;
float Speed; // M/S
float RPM; // RPM
float Turbo; // BAR
float EngTemp; // C
float Fuel; // 0 to 1
float OilPressure; // BAR
float OilTemp; // C
unsigned DashLights; // Dash lights available (see DL_x below)
unsigned ShowLights; // Dash lights currently switched on
float Throttle; // 0 to 1
float Brake; // 0 to 1
float Clutch; // 0 to 1
char Display1[16]; // Usually Fuel
char Display2[16]; // Usually Settings
int ID; // optional - only if OutGauge ID is specified
};
// OG_x - bits for OutGaugePack Flags
#define OG_TURBO 8192 // show turbo gauge
#define OG_KM 16384 // if not set - user prefers MILES
#define OG_BAR 32768 // if not set - user prefers PSI
// DL_x - bits for OutGaugePack DashLights and ShowLights
enum
{
DL_SHIFT, // bit 0 - shift light
DL_FULLBEAM, // bit 1 - full beam
DL_HANDBRAKE, // bit 2 - handbrake
DL_PITSPEED, // bit 3 - pit speed limiter
DL_TC, // bit 4 - TC active or switched off
DL_SIGNAL_L, // bit 5 - left turn signal
DL_SIGNAL_R, // bit 6 - right turn signal
DL_SIGNAL_ANY, // bit 7 - shared turn signal
DL_OILWARN, // bit 8 - oil pressure warning
DL_BATTERY, // bit 9 - battery warning
DL_ABS, // bit 10 - ABS active or switched off
DL_SPARE, // bit 11
DL_NUM
};
//////
#endif
Private Const DL_SHIFT = 1
DL_SHIFT as Single
DL_SHIFT as Boolean
Private Type OutGaugePacket
Time(0 To 3) As Byte 'unsigned int Time; // time in milliseconds (to check order)
Car(0 To 3) As Byte 'char Car[4]; // Car name
Flags(0 To 1) As Byte 'word Flags; // Combination of OG_FLAGS, see below
Gear As Byte 'byte Gear; // Reverse:0, Neutral:1, First:2...
SpareB As Byte 'byte SpareB;
Speed As Single 'float Speed; // M/S
RPM As Single 'float RPM; // RPM
Turbo As Single 'float Turbo; // BAR
EngTemp As Single 'float EngTemp; // C
Fuel As Single 'float Fuel; // 0 to 1
OilPress As Single 'float OilPress; // BAR
Spare1 As Single 'float Spare1;
Spare2 As Single 'float Spare2;
Spare3 As Single 'float Spare3;
Throttle As Single 'float Throttle; // 0 to 1
Brake As Single 'float Brake; // 0 to 1
Clutch As Single 'float Clutch; // 0 to 1
Display1(0 To 15) As Byte 'char Display1[16]; // Usually Fuel
Display2(0 To 15) As Byte 'char Display2[16]; // Usually Settings
ID As Long 'int ID; // (optional ID - if specified in cfg.txt)
End Type
Private Const OG_SHIFTLIGHT As Long = 1 '#define OG_SHIFTLIGHT 1
Private Const OG_FULLBEAM As Long = 2 '#define OG_FULLBEAM 2
Private Const OG_HANDBRAKE As Long = 4 '#define OG_HANDBRAKE 4
Private Const OG_PITSPEED As Long = 8 '#define OG_PITSPEED 8
Private Const OG_TC As Long = 16 '#define OG_TC 16
Private Const OG_HEADLIGHTS As Long = 32 '#define OG_HEADLIGHTS 32
Private Const OG_SIGNAL_L As Long = 64 '#define OG_SIGNAL_L 64
Private Const OG_SIGNAL_R As Long = 128 '#define OG_SIGNAL_R 128
Private Const OG_REDLINE As Long = 256 '#define OG_REDLINE 256
Private Const OG_OILWARN As Long = 512 '#define OG_OILWARN 512
Private Const OG_1 As Long = 1024 '#define OG_1 1024
Private Const OG_2 As Long = 2048 '#define OG_2 2048
Private Const OG_3 As Long = 4096 '#define OG_3 4096
Private Const OG_4 As Long = 8192 '#define OG_4 8192
Private Const OG_KM As Long = 16384 '#define OG_KM 16384
Private Const OG_BAR As Long = 32768 '#define OG_BAR 32768